package com.chinasofti.collection;

import java.util.ArrayList;
import java.util.Collection;

public class Demo01 {
    public static void main(String[] args) {
//        nethod1();
//        method2();
        Collection<String> c = new ArrayList<>();
        Collection<String> c1 = new ArrayList<>();
        //添加元素
        c.add("张三");
        c.add("nihao ");
        c.add("java");
        c1.add("张三");
        c1.add("nihao ");
        c1.add("java");
//        boolean 张三 = c.remove("张三");
//        System.out.println(张三);
//        c.removeAll(c);
        c.clear();
//        c1.removeAll();
        System.out.println(c);
        System.out.println(c1);


    }

    private static void method2() {
        Collection<String> c = new ArrayList<>();
        //添加元素
        c.add("张三");
        c.add("nihao ");
        c.add("java");
        //判断集合是否包含元素
        boolean 张三 = c.contains("张三");
        System.out.println(张三);
    }


    private static void nethod1() {
        Collection<String> c = new ArrayList<>();
        //添加元素
        c.add("张三");
        c.add("nihao ");
        c.add("java");
        int size = c.size();
        System.out.println(size);
        c.clear();
        boolean empty = c.isEmpty();
        System.out.println(empty);

        System.out.println(size);
    }
}
